﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/admincp.Master" AutoEventWireup="true"
    CodeBehind="Category.aspx.cs" Inherits="VINETLIFE.AdminCP.Category" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function OnClientPasteHtml(sender, args) {
                var commandName = args.get_commandName();
                var value = args.get_value();
                if (commandName == "ImageManager") {
                    //See if an img has an alt tag set
                    var div = document.createElement("DIV");
                    //Do not use div.innerHTML as in IE this would cause the image's src or the link's href to be converted to absolute path.
                    //This is a severe IE quirk.
                    Telerik.Web.UI.Editor.Utils.setElementInnerHtml(div, value);
                    //Now check if there is alt attribute
                    var img = div.firstChild;
                    //alert(div.innerHTML);

                    //Set new content to be pasted into the editor

                    if (!!img.alt) {
                        var newInner = "<center>";
                        newInner = newInner + "<img src='" + img.src + "' alt='" + img.alt + "'/></center><center>";
                        newInner = newInner + img.alt + "</center>";

                        args.set_value(newInner);
                    }
                    else {
                        var newInner = "<center><img src='" + img.src + "' alt='Bao Anh jsc'/></center><br/>";

                        args.set_value(newInner);
                    }

                }
            }
        </script>
    </telerik:RadCodeBlock>
    <script type="text/javascript">
        function SelectAndClosePopup(value) {
            cbParent.SetValue(value);
            pcParent.Hide();
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2>
        Cập nhật Danh mục Tin tức</h2>
    <table class="tablet">
        <tr>
            <td class="style8" style="width: 150px;">
                Tiêu đề:
            </td>
            <td class="style9">
                <div style="float: left; width: 300px;">
                    <asp:TextBox ID="txtTitle" runat="server" Width="273px" ValidationGroup="submitGrp"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTitle"
                        ErrorMessage="*" ValidationGroup="submitGrp"></asp:RequiredFieldValidator>
                </div>
                <div style="float: left; width: 400px; padding: 0 0 5px 0;">
                    <span style="float: left; width: 150px; display: block;">
                        <asp:RadioButton ID="rdoCT" GroupName="type" Text="" runat="server" Checked="true" />Trang
                        nội dung</span> <span style="float: left; width: 250px; display: block;">
                            <asp:RadioButton ID="rdoTT" GroupName="type" Text="" runat="server" />Trang danh
                            mục tin tức</span>
                    <asp:RadioButton ID="rdoSVD" GroupName="type" Text="Dịch vụ chi tiết" runat="server"
                        Visible="false" />
                    <asp:RadioButton ID="rdoNW" runat="server" GroupName="type" Text="Tin tức" Visible="false" />
                </div>
            </td>
        </tr>
        <tr>
            <td class="style8">
                Danh mục:
            </td>
            <td class="style9">
                <asp:DropDownList ID="cboCategory" CssClass="ddl-input" Width="250px" runat="server"
                    AppendDataBoundItems="true">
                    <asp:ListItem Value="0" Text=".: Danh mục cao cấp nhất :."></asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style8">
                Hình ảnh:
            </td>
            <td class="style9">
                <asp:FileUpload ID="fuImage" runat="server" />
                &nbsp;
                <asp:HyperLink ID="hplImage" runat="server" Target="_blank" Visible="False">[Xem 
            ảnh]</asp:HyperLink>
            </td>
        </tr>
        <tr style="display: none;">
            <td class="style8">
                Mô tả:
            </td>
            <td>
                <CKEditor:CKEditorControl ID="txtDescription" runat="server">
                </CKEditor:CKEditorControl>
            </td>
        </tr>
        <tr>
            <td class="style8">
                Nội dung chi tiết:
            </td>
            <td>
                <telerik:RadEditor ID="txtDetail" runat="server" OnClientPasteHtml="OnClientPasteHtml"
                    DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd" Width="99%" Height="700px">
                    <ImageManager MaxUploadFileSize="1024000000" ViewMode="Grid" DeletePaths="~/Media/"
                        UploadPaths="~/Media/" ViewPaths="~/Media/"></ImageManager>
                </telerik:RadEditor>
            </td>
        </tr>
        <tr>
            <td class="style8">
                MetaDes:<br />
                Độ dài: 70~160 ký tự
            </td>
            <td>
                <asp:TextBox ID="txtMetaDes" runat="server" Width="100%" ValidationGroup="submitGrp"
                    Height="60px" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                MetaTag:
            </td>
            <td>
                <asp:TextBox ID="txtMetaTag" runat="server" Width="100%" ValidationGroup="submitGrp"
                    Height="60px" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                PageTitle:
                <br />
                Độ dài: 10~70 ký tự
            </td>
            <td>
                <asp:TextBox ID="txtPageTitle" runat="server" Width="100%" ValidationGroup="submitGrp"
                    Height="60px" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                <%-- Hiển thị:--%>
                Số thứ tự
            </td>
            <td class="style4">
                <div style="float: left; vertical-align: middle;">
                    &nbsp;
                    <asp:CheckBox ID="chkIsHomePage" runat="server" />
                    Hiện ở trang chủ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:CheckBox ID="chkIsPublish" runat="server" Visible="false" />
                    <%-- Ẩn đi--%>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Số thứ tự:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
                <div style="float: left; vertical-align: middle;">
                    <asp:TextBox ID="txtOrderID" runat="server" Width="68px" ValidationGroup="submitGrp"
                        Text="0"></asp:TextBox>
                </div>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtOrderID"
                    ErrorMessage="*** Cần nhập số thứ tự" ValidationGroup="submitGrp"></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Nhập số(Giá trị từ 0~1000)"
                    ForeColor="Red" ControlToValidate="txtOrderID" Type="Integer" MinimumValue="0"
                    MaximumValue="1000"></asp:RangeValidator>
            </td>
        </tr>
        <tr>
            <td class="style8">
                &nbsp;
            </td>
            <td class="style4">
                <asp:Button ID="btnSave" runat="server" Text="Lưu" CssClass="button-gg-green" OnClick="btnSave_Click"
                    ValidationGroup="submitGrp" />
                <asp:Button ID="btnReset" runat="server" Text="Hủy" CssClass="button-gg-green" OnClick="btnReset_Click" />
            </td>
        </tr>
    </table>
</asp:Content>
